<?php
/* @var $this ProceduresController */
/* @var $model Procedures */
/* @var $form CActiveForm */
?>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl;?>/js/jquery.js"></script>
<div class="form">

<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'procedures-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<?php
	$database = Databases::model()->findAll();
	$dbs = array();
	
	
	?>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		
		<label 0="Database - Tables" for="Procedures_table_id">Database</label>
		
		<select name="Procedures[database_id]"  id="Procedures_table_id1" onchange="changeDB(this.value)">
			<?php
			foreach($database as $key=>$d){
			?>
				<option value="<?php echo outStr($d->id);?>" <?php echo (outStr($model->database_id)==outStr($d->id)) ? "selected" : ""; ?>>
					<?php echo $d->name;?>
				</option>
			<?php
			}
			
			?>
		</select>
		<div class="data">
		</div>
		
		<?php echo $form->error($model,'database_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->textField($model,'status'); ?>
		<?php echo $form->error($model,'status'); ?>
		<ol>
			<li>0 - OK </li>
			<li>1 - NOT OK </li>
			
		</ol>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->


<script>
function changeDB(val){

}
</script>